﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SuperListEx
{
  internal class PositionedRowIdentifier
  {
    #region propertiess
    public RowIdentifier RowIdentifier
    {
      get;
      private set;
    }

    public int Position
    {
      get;
      set;
    }
    #endregion

    #region overloaded operators
    public static bool operator ==(PositionedRowIdentifier lhs, PositionedRowIdentifier rhs)
    {
      if (ReferenceEquals(lhs, rhs))
      {
        return true;
      }
      if (ReferenceEquals(lhs, null))
      {
        return false;
      }
      if (ReferenceEquals(rhs, null))
      {
        return false;
      }

      return lhs.RowIdentifier == rhs.RowIdentifier && lhs.Position == rhs.Position;
    }

    public static bool operator !=(PositionedRowIdentifier lhs, PositionedRowIdentifier rhs)
    {
      return !(lhs == rhs);
    }
    #endregion

    #region constructors
    public PositionedRowIdentifier(RowIdentifier rowIdentifier, int position)
    {
      RowIdentifier = rowIdentifier;
      Position = position;
    }
    #endregion

    #region object overrides
    public override bool Equals(object obj)
    {
      return RowIdentifier.Equals(obj);
    }

    public override int GetHashCode()
    {
      return RowIdentifier.GetHashCode();
    }
    #endregion
  }
}
